package com.atis.warplot.database;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Proxy;

@Entity
@Table(name = "t_fila_hexagono")
@Proxy(lazy = false)
public class FilaHexagono {

	private int id;

	private int indice;

	private Mapa mapaRef;
	private List<ColumnaHexagono> columnaHexagono = //
			new ArrayList<ColumnaHexagono>();

	// --------------------------------------------------------------------------------

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	// --------------------------------------------------------------------------------

	public int getIndice() {
		return indice;
	}

	public void setIndice(int indice) {
		this.indice = indice;
	}

	// --------------------------------------------------------------------------------

	@ManyToOne
	public Mapa getMapaRef() {
		return mapaRef;
	}

	public void setMapaRef(Mapa mapaRef) {
		this.mapaRef = mapaRef;
	}

	// --------------------------------------------------------------------------------

	@OneToMany(mappedBy = "filaHexagonoRef", orphanRemoval = true)
	@LazyCollection(LazyCollectionOption.TRUE)
	@Cascade({CascadeType.ALL})
	public List<ColumnaHexagono> getColumnaHexagono() {
		return columnaHexagono;
	}

	public void setColumnaHexagono(List<ColumnaHexagono> columnaHexagono) {
		this.columnaHexagono = columnaHexagono;
	}

	// --------------------------------------------------------------------------------

}
